<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return redirect('auth/login');
});

// 登录
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/postlogin', 'Auth\AuthController@login');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

Route::group([
    'middleware' => ['auth'],
    'namespace' => 'Index',
    'prefix' => 'admin'], function () {
     Route::get('index', 'IndexController@index');
});
Route::group([
    'namespace' => 'Admin',
    'prefix' => 'admin'], function () {
    Route::get('kit/captcha/{tmp}', 'CommonController@captcha');
    });



Route::group([
    'middleware' => ['auth','authAdmin'],
    'namespace' => 'Admin',
    'prefix' => 'admin'], function () {

    //权限列表
    Route::get('permission/index', 'PermissionController@index');
    //权限创建
    Route::get('permission/create','PermissionController@create');
    //权限创建 保存
    Route::post('permission/doCreate','PermissionController@doCreate');
    //权限编辑
    Route::get('permission/edit','PermissionController@edit');
    //权限编辑 保存
    Route::post('permission/doEdit','PermissionController@doEdit');
    //权限删除
    Route::post('permission/delete','PermissionController@deleteOnePermission');

    //角色列表
    Route::get('role/index', 'RoleController@index');
    //角色创建
    Route::get('role/create', 'RoleController@create');
    //角色创建 保存
    Route::post('role/doCreate', 'RoleController@doCreate');
    // 角色编辑
    Route::get('role/edit', 'RoleController@edit');
    //角色编辑 保存
    Route::post('role/doEdit', 'RoleController@doEdit');
    //角色删除
    Route::post('role/delete','RoleController@delete');

    //用户列表
    Route::get('user/index', 'UserController@index');
    //用户创建
    Route::get('user/create', 'UserController@create');
    //用户创建
    Route::post('user/doCreate','UserController@doCreate');
    //用户编辑
    Route::get('user/edit', 'UserController@edit');
    //用户编辑 保存
    Route::post('user/doEdit', 'UserController@doEdit');
    //用户重置密码
    Route::post('user/resetPasswd', 'UserController@resetPasswd');
    //用户删除
    Route::post('user/delete', 'UserController@delete');
    //修改密码
    Route::get('user/modifyPw','UserController@modifyPasswd');
    //用户编辑 保存
    Route::post('user/doModifyPw', 'UserController@doModifyPasswd');

    //栏目列表
    Route::get('category/index','CategoryController@index');
    //栏目 添加
    Route::get('category/create','CategoryController@create');
    //栏目保存 添加
    Route::post('category/doCreate','CategoryController@doCreate');
    //栏目 编辑
    Route::get('category/edit','CategoryController@edit');
    //栏目保存 添加
    Route::post('category/doEdit','CategoryController@doEdit');
    //栏目删除
    Route::post('category/delete','CategoryController@deleteOneCategory');

});

Route::group(['namespace' => 'Ceb', 'prefix' => 'ceb'],function(){
    Route::get('channelproviders/index','ChannelProviderController@index');
    Route::get('channelproviders/create','ChannelProviderController@create');
    Route::post('channelproviders/store','ChannelProviderController@store');
    Route::get('channels/index','ChannelController@index');
    Route::get('channels/create','ChannelController@create');
    Route::post('channels/store','ChannelController@store');
    Route::post('channels/openstatus','ChannelController@changeOpenStatus');
    Route::get('channels/check','ChannelController@check');
    Route::post('channels/check','ChannelController@doCheck');
    Route::post('channels/settle','ChannelController@settle');
    Route::get('channels/show','ChannelController@show');
    Route::get('channels/daily','ChannelController@daily');

    Route::get('advertistment/index','AdvertistmentController@index');
    Route::get('advertistment/create','AdvertistmentController@index');

    Route::get('sms/index','SmsController@index');
    Route::get('sms/create','SmsController@create');

    Route::get('behavior/index','BehaviorController@index');
    //群体管理
    Route::get('community/index','CommunityController@index');
    //群体管理 添加
    Route::get('community/create','CommunityController@create');
    //群体管理 编辑
    Route::get('community/edit','CommunityController@edit');

    //奖池管理
    Route::get('giftPacks/index','GiftPacksController@index');
    //奖池管理 添加
    Route::get('giftPacks/create','GiftPacksController@create');
    //奖池管理 编辑
    Route::get('giftPacks/edit','GiftPacksController@edit');

    //奖池管理 根据奖池查找
    Route::get('rewardpackages/search','GiftPacksController@create');



    Route::get('activities/index','ActivityController@index');
    Route::get('activities/list','ActivityController@getActivityListByPage');
    Route::get('activities/create','ActivityController@create');
    Route::post('activities/store','ActivityController@store');
    Route::get('activities/delete','ActivityController@delete');
    Route::get('activities/check','ActivityController@check');

    Route::post('users/filters','UserController@filters');
});

Route::group(['namespace' => 'Common','prefix' => 'common'],function(){
    Route::post('files/upload','UploadController@upload');
});